# noinspection PyBroadException
class chackStr:
    # 检查整数，返回整数字符串，错误返回异常提醒
    @staticmethod
    def ChackInt(myNumber):
        if type(myNumber) == float or type(myNumber) == int or type(myNumber) == complex:
            number = int(myNumber)
            if myNumber < 0:
                number = "【异常 负数】"
            elif 0 < myNumber < 1:
                number = "【异常 小数数】"
            return str(number)
        else:
            return "【异常 非数字】"

    # 检查是否为 null，正常返回原值，错误返回异常提醒
    @staticmethod
    def ChackNull(obj):
        if obj:
            obj = "【异常 Null】"
        return obj

    # 检查是否未 Null/空格/空字符串 ，正常返回原值，错误返回异常提醒
    @staticmethod
    def ChackNullOrSpace(obj):
        if not obj:
            obj = "【异常 Null】"
        elif obj.isspace():
            obj = "【异常 空格】"
        return obj

    @staticmethod
    def ToStr(myNumber):
        if type(myNumber) == float or type(myNumber) == int or type(myNumber) == complex:
            number = int(myNumber)
            return str(number)
        elif not myNumber:
            return "Null"
        elif myNumber.isspace():
            return "空格"
        else:
            return myNumber


"""
if __name__ == "__main__":
    item = chackStr.ToStr(-0.25)
    print(item)
"""
